﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@model dynamic
@{   
    int i = 0;    
}
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
     <tr>
         <td>
             <table style="width:100%;" border="1" cellpadding="0" cellspacing="0"  class="tablaDetalle">
                <tr class="tituloDetalleBlue_1" align="center">
                    <td style="width:15px;">#</td>                                    
                    <td align="left">Nombre de la dependencia</td>
                    <td style="width:40px;">Id</td>
                    <td style="width:40px;">Seleccionable</td>
                    <td style="width:140px;">Código dependencia</td> 
                    <td align="left" >Dependencia padre</td>
                    <td align="left" >Región</td>
                    <td align="left" style="width:110px;">Tipo dependencia</td>                                  
                    <td style="width:120px;">Fecha Inicio vigencia</td>
                    <td style="width:120px;">Fecha fin vigencia</td>
                    <td style="width:80px;">Agregar</td>
                    <td>Actualizar</td>                                       
                </tr>
            
                @foreach(var item in  Model) {
                    i++;
                    <tr class="@(i%2 != 0 ? "odd" : "even")" align="center" id="trDet1@(i)" >
                         <td>@i</td>
                         <td id="tdDet1@(i)" align="left" class="letraLink8"  onclick="javascript:detalleDependenciaById(this,'@(item.nIdeDep)');">@item.vDescripcion</td>
                         <td>@String.Format("{0:0000}", item.nIdeDep)</td>
                         <td>@(@item.nBanSel == 1 ? "Si" : "No")</td>
                         <td>@item.nCodDep</td>
                         <td align="left">@item.padre</td>
                        <td align="left">@item.region</td>
                         <td>@item.TipoDepe</td>
                         <td>@String.Format("{0:dd/MM/yyyy}",item.dFecIniVig)</td>
                        <td>
                            @if (@item.dFecFinVig.ToString().Length <= 0) {               
                              <span><span class="letraLink8" onclick="javascript:cerrarVigenciaDep(this,'@item.nIdeDep');">Cerrar Vigencia</span></span>
                            }else{
                                @String.Format("{0:dd/MM/yyyy}", item.dFecFinVig);
                            }
                        </td>
                        <td>
                            @if (@item.dFecFinVig.ToString().Length <= 0) {               
                              <span class="letraLinkB8" onclick="javascript:addHijoAlaDependencia(this,'@item.nIdeDep','@item.nIdeDepRegion');">Agregar</span>
                            }else{
                                @:Agregar
                            }
                        </td>
                        <td>
                            @if (@item.dFecFinVig.ToString().Length <= 0) {               
                              <span class="letraLinkB8" onclick="javascript:updateDependencia(this,'@item.nIdeDep');">Actualizar</span>
                            }else{
                                @:Actualizar
                            }
                        </td>
                     </tr> 
                }
                </table>  
                   
         </td>
      </tr>
</table>
   